<?php
            $this->headTitle($this->title);
?>
<br><br>
<div id="message" class="error"><?php echo $this->message ?></div><br>
    <form name="password_form" id="password_form" action="<?php echo $this->url(array( 'controller' => 'process', 'action'     => 'forgotpassword'),'default', true) ?>" method="post">
        <label>Email Address:</label>&nbsp;&nbsp;&nbsp;<input type="text" name="emailAddress" id="_emailAddress" size="50" value="<?php if($this->users !=null) echo $this->users->getEmailAddress() ?>"/>&nbsp;&nbsp;&nbsp;<input type="submit" value="Submit" id="submit"/>
        <input type="hidden" name="action" value="_forgot"/>
        <br>
</form>

<script>
$(document).ready(function(){
     $("#submit").click(function(){
                var mail = $("#_emailAddress").val();
                var valid =true;
                if (!mail.match(/^([a-z0-9._-]+@[a-z0-9._-]+\.[a-z]{2,4}$)/i)) {
                         $("#message").html("Email Address  is not valid");
                        valid= false;
		} else{
                     $("#message").html("");
                }
                  if(!valid){
                    return false;
                }else{
                    $("form#password_form").submit();
                }

     });

});

</script>